/*
    SUSAN® - Sole of Unix Save ANything

   Copyright (C) 2010-2011 Bacula Systems(R) SA
   Copyright (C) 2016-2020 Hechzh Property

   This program is Free Software; you can modify it under the terms of
   version three of the GNU Affero General Public License as published by the
   Free Software Foundation, which is listed in the file LICENSE.

   

   
*/
/*
 * @file
 * You can include this file to your plugin to have
 * access to some common tools and utilities provided by Bareos
 */

#ifndef BAREOS_PLUGINS_INCLUDE_COMMON_H_
#define BAREOS_PLUGINS_INCLUDE_COMMON_H_


#define JT_BACKUP 'B'  /* Backup Job */
#define JT_RESTORE 'R' /* Restore Job */

#define L_FULL 'F'         /* Full backup */
#define L_INCREMENTAL 'I'  /* since last backup */
#define L_DIFFERENTIAL 'D' /* since last full backup */

#define Dmsg(context, level, ...)                                             \
  if (bareos_core_functions && context) {                                     \
    bareos_core_functions->DebugMessage(context, __FILE__, __LINE__, level,   \
                                        __VA_ARGS__);                         \
  } else {                                                                    \
    fprintf(stderr,                                                           \
            "Dmsg: bareos_core_functions(%p) and context(%p) need to be set " \
            "before Dmsg call\n",                                             \
            bareos_core_functions, context);                                  \
  }

#define Jmsg(context, type, ...)                                              \
  if (bareos_core_functions && context) {                                     \
    bareos_core_functions->JobMessage(context, __FILE__, __LINE__, type, 0,   \
                                      __VA_ARGS__);                           \
  } else {                                                                    \
    fprintf(stderr,                                                           \
            "Jmsg: bareos_core_functions(%p) and context(%p) need to be set " \
            "before Jmsg call\n",                                             \
            bareos_core_functions, context);                                  \
  }
#endif  // BAREOS_PLUGINS_INCLUDE_COMMON_H_
